home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 773 b | 36 lines | [TEXT/ttxt] |
- --<<<
-
- -- ScriptX Architecture and Components Guide
- -- Collections Chapter
- -- LockedArray example
-
- -- This example specializes just two Collection methods
- -- To create a robust LockedArray. You should specialize all
- -- methods that add, remove, or change the order of items
- -- in a Collection.
-
- class LockedArray (Array)
- inst vars lock
- instance methods
- method init self #rest args -> (
- apply nextMethod self args
- self.lock := new Lock
- )
- method acquire self -> acquire self.lock
- method relinquish self -> relinquish self.lock
- method add self key value -> (
- acquire self
- nextMethod self key value
- relinquish self
- )
- method deleteOne self value -> (
- acquire self
- nextMethod self value
- relinquish self
- )
- -- specialize other methods here
- end
-
- -->>>
-
-